/*	main.c 
 *  Arizona State University
 *  CSE 325: Embedded Systems Programming
 *  Lab 5: Game of life
 *  Georgii Tkachuk, Brentton Garber
 *   Emails: 	gtkachuk@asu.edu btgarber@asu.edu
 * 	Description: 
 * 	The Game Of Life. 	The Initial Pattern can be found in game.c module. The program takes the initial pattern and transforms it according to the rules 
 * 						of the game. The Rules are specified in the game.c file and can be modified. 
 * 						The system utilizes two buttons!!!
 * 						PRESS BUTTON 2 TO TURN THE GAME OFF.
 * 						PRESS BUTTON 1 TO TURN THE GAME BACK ON OR RESET THE PATTERN TO INITIAL.
 * 
 * 	Main module. Initializes all components and starts the game. 
 * 
 */


#include "support_common.h" /* include peripheral declarations and more */
#if (CONSOLE_IO_SUPPORT || ENABLE_UART_SUPPORT)
/* Standard IO is only possible if Console or UART support is enabled. */
#include <stdio.h>
#endif

#include "support_common.h"
#include "common.h"

// Initialize our components
static void init()
{
	ledmatrix_init();			// Initialize the LED Matrix
	gpt_init();					// Initialize the gpt
	pit_init();					// Initialize the pit
	
	int_uninhibit_all();		// uninhibit all
}

// Calls init() to initialize the hardware, Starts the game, then drops into an infinite loop.
int main(void)
{
	// Initialize the components
	init();
	
	// automatically play the game when started
	play_game();
	
	while (1) { }
	
	return 0;
}